package com.tuozixuan.camel.validate;

import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;

@Component
public class ValidateDemoRoute extends RouteBuilder {

	@Override
	public void configure() {
		
		// 验证消息体是否为数字，如果是则输出到标准输出
//        from("timer:firedOnceTimer?repeatCount=1").setBody().constant("11223344")
//        	.validate(body().regex("[0-9]+")).to("stream:out");
        
		// 验证消息体是否为数字，如果否则抛出异常
//        from("timer:firedOnceTimer?repeatCount=1").setBody().constant("11223344a")
//    	.validate(body().regex("[0-9]+")).to("stream:out");
        
//      from("timer:firedOnceTimer?repeatCount=1")
//      	.setBody().constant("aaaaaa")
//        .setHeader("bar").constant("11223344")
//        .validate(header("bar").regex("[0-9]+"))
//    	.to("stream:out");
        
	}

}
